<%@page import="edu.hcmus.sow.utils.StringUtil"%>
<%@ page language="java" isELIgnored="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@page import="javax.swing.text.DateFormatter"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="org.ocpsoft.pretty.time.PrettyTime"%>
<jsp:directive.include file="/WEB-INF/sitemesh-decorators/include.jsp" />

<!-- Begin show Task whenever -->
<c:forEach items="${tasks }" var="task" varStatus="i">
	<li class="droparea" id="148671">
		<div>
				<div class="task taskData">
					<div style="visibility: hidden;" class="toolbar_left">
						<a class="action taskcross" href="#">move <img src="${pageContext.request.contextPath}/images/task-move-icon.png"></a>
					</div>
					<span class="spinnerContainer" style="display: none;" id="spinnerContainer6d">&nbsp;
						<img src="${pageContext.request.contextPath}/images/throbber.gif">
					</span>
					
					<div class="fixed task_infos" style="width: 500px;">
						<c:set var="createdDate" value="${task.createdDate.getTime()}"></c:set>
						<span style="text-align:right; font-style:italic; color: gray;">Updated&nbsp;<%=new PrettyTime().format((Date) pageContext.getAttribute("createdDate"))%></span> by&nbsp; ${task.userByCreatedBy.username}
						<a style="position:static;" class="link comments" href="${pageContext.request.contextPath}/task/${task.id}/view">
							<c:if test="${comments.get(i.count -1) == null }">
								<span class="">0</span>
							</c:if>
							<c:if test="${comments.get(i.count -1) != null }">
								<span class="">${comments.get(i.count -1)}</span>
							</c:if>
						</a> 
						<span class="author"></span>
						<div style="margin-left: 200px;" class="indicators">
							<div class="progress" title="Progress">
								<div class="mask"></div>
								<div class="status" style="width: ${task.adjustedEstimate}%;"></div>
							</div>
							<div class="est" title="Estimated time">
								<div class="mask"></div>
								<div class="status" style="width: 0%;"></div>
							</div>
						</div>
					</div>
					<div class="fluid">
						<a class="taskdone" href="${pageContext.request.contextPath}/task/${task.id}/markCompleted?project=${task.project.id}"
							title="Click to mark task as done" id="finishedLink6e"
							onclick=""><span></span></a>
						&nbsp; 
						
						<a href="${pageContext.request.contextPath}/task/${task.id}/view">
						
						<c:set var="title" value="${task.title}"></c:set> 
						<c:set var="description" value="${task.description}"></c:set>
						<span>
							<%=StringUtil.subStringToDisplay((String)(pageContext.getAttribute("title")), 50) %>
						</span>
						</a>
						<span style="margin-left: 10px; font-style:italic;" class="cubeLink">
							[<%=StringUtil.removeHTML(StringUtil.subStringToDisplay((String)(pageContext.getAttribute("description")).toString(), 80)) %>]
						</span>
					</div>
				</div>
			<div class="spacer">&nbsp;</div>
		</div>
	</li>
	
</c:forEach>
<!-- End show Task whenever -->